package crazy.memory1;

public class Apple extends Fruit
{
	@Override
	public void info()
	{
		System.out.println("Apple method");
	}
	
	public void AccessSuperInfo()
	{
		super.info();//真正表现出Fruit类的行为    super不能当做真正的引用变量使用
	}
	
	public Fruit getSuper()
	{
		return getThis();//返回的实际上是该apple本身
	}
	
	String color = "red";
	
	public static void main(String[] args)
	{
		Apple a = new Apple();
		Fruit f = a.getSuper();
		System.out.println("a and f are same:"+ (a == f));
		System.out.println(a.color);
		System.out.println(f.color);
		a.info();
		f.info();
		a.AccessSuperInfo();
		
	}
	
}

class Fruit
{
	String color = "not sure color";
	
	public Fruit getThis()
	{
		return this;//直接返回调用该方法的对象
	}
	
	public void info()
	{
		System.out.println("Fruit method");
	}
}

